//
//  NSDictionary+category.m
//  FlowerTown
//
//  Created by lee on 2018/5/21.
//  Copyright © 2018年 HuaZhen. All rights reserved.
//

#import "NSDictionary+category.h"
#import <objc/runtime.h>

@implementation NSDictionary (category)
+ (void)load {
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        method_exchangeImplementations(class_getInstanceMethod(NSClassFromString(@"__NSPlaceholderDictionary"), NSSelectorFromString(@"initWithObjects:forKeys:count:")), class_getInstanceMethod(NSClassFromString(@"NSDictionary"), NSSelectorFromString(@"initWithObjects_st:forKeys:count:")));
    });
}

- (instancetype)initWithObjects_st:(id *)objects forKeys:(id<NSCopying> *)keys count:(NSUInteger)count {
    NSUInteger rightCount = 0;
    for (NSUInteger i = 0; i < count; i++)
    {
        if (objects[i] == nil) {
            objects[i] = @"";
        }
        rightCount++;
    }
//    {
//        if (!(keys[i] && objects[i])) {
//            break;
//        }else{
//            rightCount++;
//        }
//    }
    self = [self initWithObjects_st:objects forKeys:keys count:rightCount];
    return self;
}
@end
